package pl.mess.core.tags.elements;

import pl.mess.core.tags.writer.MESSXmlWriter;
import pl.mess.core.tags.ifc.ControlAttribute;
import pl.mess.core.uiobjects.MESSNewsEntry;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: gibffe
 * Date: Jun 16, 2006
 * Time: 12:37:56 PM
 * To change this template use File | Settings | File Templates.
 */
public class MESSNewsViewElementTag extends MESSBaseTag {

    private static final String TAG_NAME = "newsElement";

    /**
     * news entry date
     */
    @ControlAttribute public Timestamp entryDate;

    /**
     * news title
     */
    @ControlAttribute public String title;

    /**
     * news header (short content)
     */
    @ControlAttribute public String header;

    /**
     * news author
     */
    @ControlAttribute public String author;

    /**
     * Return tag name
     * @return
     */
    public String getTagName() {
        return TAG_NAME;
    }

    /**
     * Public constructor
     * @param writer
     */
    public MESSNewsViewElementTag(MESSXmlWriter writer, MESSNewsEntry element) {
        // init tag object
        this.setAuthor(element.getAuthor());
        this.setEntryDate(element.getEntryDate());
        this.setTitle(element.getTitle());
        this.setHeader(element.getHeader());

        // set writer
        this.setWriter(writer);
    }


    // property: entry date
    public Timestamp getEntryDate() {
        return entryDate;
    }

    public void setEntryDate(Timestamp entryDate) {
        this.entryDate = entryDate;
    }

    // property: title
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    // property: header
    public String getHeader() {
        return header;
    }

    public void setHeader(String header) {
        this.header = header;
    }

    // property: author
    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }
}
